package com.ml.workmq.producer;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * 模拟两个订单发送消息
 * @author ml
 */
@RestController
public class NormalProducer {
    @Autowired
    private RocketMQTemplate rocketMqTemplate;
    /**
     * 发送同步顺序消息
     */
    @RequestMapping("/testSend")
    public String testSend(){
        LocalDateTime currentTime = LocalDateTime.now();
        rocketMqTemplate.convertAndSend("test-topic1", currentTime.toString());
        return currentTime.toString();
    }
}
